{template 'public/header'}
{template 'public/comhead'}
<ul class="nav nav-tabs">
    <li><a href="{php echo $this->createWebUrl('marketing', array('op' => 'display'))}">市场专员管理</a></li>
    <li><a href="{php echo $this->createWebUrl('marketing', array('op' => 'post'))}">添加市场专员</a></li>
    <li {if $operation == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('marketinglevel', array('op' => 'display'))}">专员等级管理</a></li>
    <li {if $operation == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('marketinglevel', array('op' => 'post'))}">添加专员等级</a></li>
</ul>
{if $operation == 'post'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default">
            <div class="panel-heading">
                专员等级编辑
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">等级名称</label>
                    <div class="col-sm-9">
                        <input type="text" name="title" class="form-control" value="{$type['title']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">门店数量</label>
                    <div class="col-sm-9">
                        <input type="text" name="storecount" class="form-control" value="{$type['storecount']}" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">提成费率</label>
                    <div class="col-sm-9">
                        <div class="input-group ">
                            <input type="text" name="fee_rate" class="form-control" value="{$type['fee_rate']}">
							<span class="input-group-btn">
								<button class="btn btn-default" type="button">%</button>
							</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="保存设置" class="btn btn-primary col-lg-3" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{elseif $operation == 'display'}
<div class="main">
    <div class="panel panel-default">
        <form action="" method="post" class="form-horizontal form" >
            <input type="hidden" name="storeid" value="{$storeid}" />
            <div class="table-responsive panel-body">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                    <tr>

                        <th style="width:25%;">等级名称</th>
                        <th style="width:25%;">门店数量</th>
                        <th style="width:20%;">提成费率</th>
                        <th style="text-align:right;">操作</th>
                    </tr>
                    </thead>
                    <tbody id="level-list">
                    {loop $list $row}
                    <tr>
                        <td>
                            {$row['title']}
                        </td>
                        <td>
                            {$row['storecount']}
                        </td>
                        <td>
                            {$row['fee_rate']}%
                        </td>
                        <td style="text-align:right;"><a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('marketinglevel', array('op' => 'post', 'id' => $row['id']))}" title="编辑">改</a>&nbsp;&nbsp;<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('marketinglevel', array('op' => 'delete', 'id' => $row['id']))}" onclick="return confirm('确认删除此分类吗？');return false;" title="删除">删</a></td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
        </form>
    </div>
    {$pager}
</div>
{/if}
{if $_W['isfounder']}
{template 'common/footer'}
{else}
{template 'public/footer'}
{/if}